using Microsoft.VisualBasic.CompilerServices;
using SJVars;
using System;
using System.Collections;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Windows.Forms;
using yW5Lib;

namespace yWriter6
{
	[DesignerGenerated]
	internal class frmFillList : Form
	{
		private IContainer components;

		public ToolTip ToolTip1;

		[CompilerGenerated]
		[AccessedThroughProperty("ImageList2")]
		private ImageList _ImageList2;

		[field: AccessedThroughProperty("ImageList2")]
		public virtual ImageList ImageList2
		{
			get;
			[MethodImpl(MethodImplOptions.Synchronized)]
			set;
		}

		public frmFillList()
		{
			InitializeComponent();
		}

		[DebuggerNonUserCode]
		protected override void Dispose(bool Disposing)
		{
			if (Disposing && components != null)
			{
				components.Dispose();
			}
			base.Dispose(Disposing);
		}

		[System.Diagnostics.DebuggerStepThrough]
		private void InitializeComponent()
		{
			components = new System.ComponentModel.Container();
			System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(yWriter6.frmFillList));
			ToolTip1 = new System.Windows.Forms.ToolTip(components);
			ImageList2 = new System.Windows.Forms.ImageList(components);
			SuspendLayout();
			ImageList2.ImageStream = (System.Windows.Forms.ImageListStreamer)resources.GetObject("ImageList2.ImageStream");
			ImageList2.TransparentColor = System.Drawing.Color.FromArgb(192, 192, 192);
			ImageList2.Images.SetKeyName(0, "project");
			ImageList2.Images.SetKeyName(1, "viewpoint");
			ImageList2.Images.SetKeyName(2, "item");
			ImageList2.Images.SetKeyName(3, "location");
			ImageList2.Images.SetKeyName(4, "character");
			ImageList2.Images.SetKeyName(5, "todo");
			ImageList2.Images.SetKeyName(6, "chapter");
			ImageList2.Images.SetKeyName(7, "note");
			ImageList2.Images.SetKeyName(8, "x");
			ImageList2.Images.SetKeyName(9, "scene");
			ImageList2.Images.SetKeyName(10, "chapterunused");
			ImageList2.Images.SetKeyName(11, "sceneunused");
			ImageList2.Images.SetKeyName(12, "edit");
			ImageList2.Images.SetKeyName(13, "outcome");
			ImageList2.Images.SetKeyName(14, "conflict");
			ImageList2.Images.SetKeyName(15, "goal");
			base.AutoScaleDimensions = new System.Drawing.SizeF(6f, 14f);
			base.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
			BackColor = System.Drawing.SystemColors.Control;
			base.ClientSize = new System.Drawing.Size(250, 165);
			Cursor = System.Windows.Forms.Cursors.Default;
			Font = new System.Drawing.Font("Arial", 8f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 0);
			base.Location = new System.Drawing.Point(3, 24);
			base.Name = "frmFillList";
			RightToLeft = System.Windows.Forms.RightToLeft.No;
			Text = "Form1";
			ResumeLayout(false);
		}

		public void FillAllCharList(ref clsProject cProject, ref ListView aList, bool MajorOnly)
		{
			int num = MajorOnly ? 1 : 2;
			aList.Items.Clear();
			bool flag = default(bool);
			if (aList.Columns.Count > 1)
			{
				flag = true;
			}
			bool flag2 = default(bool);
			if (aList.Columns.Count > 2)
			{
				flag2 = true;
			}
			aList.SmallImageList = ImageList2;
			int num2 = 0;
			try
			{
				int num3 = num;
				IEnumerator enumerator = default(IEnumerator);
				for (int i = 1; i <= num3; i++)
				{
					try
					{
						enumerator = cProject.Chars.GetEnumerator();
						while (enumerator.MoveNext())
						{
							clsCharacter clsCharacter = (clsCharacter)enumerator.Current;
							if (((i == 1) & clsCharacter.Major) | ((i == 2) & !clsCharacter.Major))
							{
								ListViewItem listViewItem = aList.Items.Add(Conversions.ToString(clsCharacter.ID), clsCharacter.Title, "");
								listViewItem.Tag = Conversions.ToString(clsCharacter.ID);
								if (flag)
								{
									listViewItem.SubItems.Add(clsCharacter.FullName);
								}
								if (flag2)
								{
									try
									{
										listViewItem.SubItems.Add(clsCharacter.AKA);
									}
									catch (Exception ex)
									{
										ProjectData.SetProjectError(ex);
										Exception ex2 = ex;
										ProjectData.ClearProjectError();
									}
								}
								if (clsCharacter.Major)
								{
									listViewItem.ImageKey = "viewpoint";
								}
								else
								{
									listViewItem.ImageKey = "character";
								}
								num2++;
							}
						}
					}
					finally
					{
						if (enumerator is IDisposable)
						{
							(enumerator as IDisposable).Dispose();
						}
					}
				}
				if (aList.Items.Count > 0)
				{
					aList.Items[0].Selected = false;
				}
			}
			catch (Exception ex3)
			{
				ProjectData.SetProjectError(ex3);
				Exception ex4 = ex3;
				clsShared.cLog.AddAction(ex4, MethodBase.GetCurrentMethod());
				ProjectData.ClearProjectError();
			}
		}

		public void FillCharInScene(ref clsProject cProject, ref ListView aList, int ScID, bool MajorOnly)
		{
			bool flag = default(bool);
			if (aList.Columns.Count > 1)
			{
				flag = true;
			}
			bool flag2 = default(bool);
			if (aList.Columns.Count > 2)
			{
				flag2 = true;
			}
			aList.Items.Clear();
			aList.Tag = Conversions.ToString(ScID);
			aList.SmallImageList = ImageList2;
			try
			{
				int charCount = cProject.get_SceneByID(ScID).CharCount;
				for (int i = 1; i <= charCount; i++)
				{
					int num = ((clsSceneBase)cProject.get_SceneByID(ScID)).get_CharID(i);
					if (num != 0)
					{
						clsCharacter clsCharacter = cProject.get_CharByID(num);
						if (Operators.CompareString(clsCharacter.Title, "N/A", TextCompare: false) != 0 && (!MajorOnly | (MajorOnly & clsCharacter.Major)))
						{
							ListViewItem listViewItem = aList.Items.Add(Conversions.ToString(num), clsCharacter.Title, "");
							listViewItem.Tag = Conversions.ToString(num);
							if (flag)
							{
								listViewItem.SubItems.Add(clsCharacter.FullName);
							}
							if (flag2)
							{
								try
								{
									listViewItem.SubItems.Add(clsCharacter.AKA);
								}
								catch (Exception ex)
								{
									ProjectData.SetProjectError(ex);
									Exception ex2 = ex;
									ProjectData.ClearProjectError();
								}
							}
							if (i == 1)
							{
								listViewItem.ImageKey = "viewpoint";
							}
							else
							{
								listViewItem.ImageKey = "character";
							}
						}
					}
				}
				if (aList.Items.Count > 0)
				{
					aList.Items[0].Selected = false;
				}
			}
			catch (Exception ex3)
			{
				ProjectData.SetProjectError(ex3);
				Exception ex4 = ex3;
				clsShared.cLog.AddAction(ex4, MethodBase.GetCurrentMethod());
				ProjectData.ClearProjectError();
			}
		}

		public void FillLocationsInScene(ref clsProject cProject, ref ListView aList, int ScID)
		{
			bool flag = default(bool);
			if (aList.Columns.Count > 1)
			{
				flag = true;
			}
			bool flag2 = default(bool);
			if (aList.Columns.Count > 2)
			{
				flag2 = true;
			}
			aList.Items.Clear();
			aList.Tag = Conversions.ToString(ScID);
			aList.SmallImageList = ImageList2;
			clsScene clsScene = cProject.get_SceneByID(ScID);
			try
			{
				int locationCount = clsScene.LocationCount;
				for (int i = 1; i <= locationCount; i++)
				{
					string text = Conversions.ToString(((clsSceneBase)cProject.get_SceneByID(ScID)).get_LocationID(i));
					clsLocation clsLocation = cProject.get_LocationByID(((clsSceneBase)clsScene).get_LocationID(i));
					ListViewItem listViewItem = aList.Items.Add(text, clsLocation.Title, "location");
					if (flag)
					{
						listViewItem.SubItems.Add("");
					}
					if (flag2)
					{
						try
						{
							listViewItem.SubItems.Add(clsLocation.AKA);
						}
						catch (Exception ex)
						{
							ProjectData.SetProjectError(ex);
							Exception ex2 = ex;
							ProjectData.ClearProjectError();
						}
					}
					listViewItem.Tag = text;
				}
			}
			catch (Exception ex3)
			{
				ProjectData.SetProjectError(ex3);
				Exception ex4 = ex3;
				clsShared.cLog.AddAction(ex4, MethodBase.GetCurrentMethod());
				ProjectData.ClearProjectError();
			}
		}

		public void FillItemsInScene(ref clsProject cProject, ref ListView aList, int ScID)
		{
			bool flag = default(bool);
			if (aList.Columns.Count > 1)
			{
				flag = true;
			}
			bool flag2 = default(bool);
			if (aList.Columns.Count > 2)
			{
				flag2 = true;
			}
			aList.Items.Clear();
			aList.Tag = Conversions.ToString(ScID);
			aList.SmallImageList = ImageList2;
			try
			{
				int itemCount = cProject.get_SceneByID(ScID).ItemCount;
				for (int i = 1; i <= itemCount; i++)
				{
					string text = Conversions.ToString(((clsSceneBase)cProject.get_SceneByID(ScID)).get_ItemID(i));
					clsItem clsItem = cProject.get_ItemByID(((clsSceneBase)cProject.get_SceneByID(ScID)).get_ItemID(i));
					ListViewItem listViewItem = aList.Items.Add(text, clsItem.Title, "item");
					if (flag)
					{
						listViewItem.SubItems.Add("");
					}
					if (flag2)
					{
						try
						{
							listViewItem.SubItems.Add(clsItem.AKA);
						}
						catch (Exception ex)
						{
							ProjectData.SetProjectError(ex);
							Exception ex2 = ex;
							ProjectData.ClearProjectError();
						}
					}
					listViewItem.Tag = text;
				}
			}
			catch (Exception ex3)
			{
				ProjectData.SetProjectError(ex3);
				Exception ex4 = ex3;
				clsShared.cLog.AddAction(ex4, MethodBase.GetCurrentMethod());
				ProjectData.ClearProjectError();
			}
		}

		public void FillAllLocations(ref clsProject cProject, ref ListView aList)
		{
			bool flag = default(bool);
			if (aList.Columns.Count > 1)
			{
				flag = true;
			}
			bool flag2 = default(bool);
			if (aList.Columns.Count > 2)
			{
				flag2 = true;
			}
			aList.Items.Clear();
			aList.SmallImageList = ImageList2;
			try
			{
				IEnumerator enumerator = default(IEnumerator);
				try
				{
					enumerator = cProject.Locations.GetEnumerator();
					while (enumerator.MoveNext())
					{
						clsLocation clsLocation = (clsLocation)enumerator.Current;
						ListViewItem listViewItem = aList.Items.Add(Conversions.ToString(clsLocation.ID), clsLocation.Title, "location");
						if (flag)
						{
							listViewItem.SubItems.Add("");
						}
						if (flag2)
						{
							try
							{
								listViewItem.SubItems.Add(clsLocation.AKA);
							}
							catch (Exception ex)
							{
								ProjectData.SetProjectError(ex);
								Exception ex2 = ex;
								ProjectData.ClearProjectError();
							}
						}
						listViewItem.Tag = Conversions.ToString(clsLocation.ID);
					}
				}
				finally
				{
					if (enumerator is IDisposable)
					{
						(enumerator as IDisposable).Dispose();
					}
				}
				if (aList.Items.Count > 0)
				{
					aList.Items[0].Selected = false;
				}
			}
			catch (Exception ex3)
			{
				ProjectData.SetProjectError(ex3);
				Exception ex4 = ex3;
				clsShared.cLog.AddAction(ex4, MethodBase.GetCurrentMethod());
				ProjectData.ClearProjectError();
			}
		}

		public void FillAllItems(ref clsProject cProject, ref ListView aList)
		{
			bool flag = default(bool);
			if (aList.Columns.Count > 1)
			{
				flag = true;
			}
			bool flag2 = default(bool);
			if (aList.Columns.Count > 2)
			{
				flag2 = true;
			}
			aList.Items.Clear();
			aList.SmallImageList = ImageList2;
			try
			{
				IEnumerator enumerator = default(IEnumerator);
				try
				{
					enumerator = cProject.Items.GetEnumerator();
					while (enumerator.MoveNext())
					{
						clsItem clsItem = (clsItem)enumerator.Current;
						ListViewItem listViewItem = aList.Items.Add(Conversions.ToString(clsItem.ID), clsItem.Title, "item");
						if (flag)
						{
							listViewItem.SubItems.Add("");
						}
						if (flag2)
						{
							try
							{
								listViewItem.SubItems.Add(clsItem.AKA);
							}
							catch (Exception ex)
							{
								ProjectData.SetProjectError(ex);
								Exception ex2 = ex;
								ProjectData.ClearProjectError();
							}
						}
						listViewItem.Tag = Conversions.ToString(clsItem.ID);
					}
				}
				finally
				{
					if (enumerator is IDisposable)
					{
						(enumerator as IDisposable).Dispose();
					}
				}
				if (aList.Items.Count > 0)
				{
					aList.Items[0].Selected = false;
				}
			}
			catch (Exception ex3)
			{
				ProjectData.SetProjectError(ex3);
				Exception ex4 = ex3;
				clsShared.cLog.AddAction(ex4, MethodBase.GetCurrentMethod());
				ProjectData.ClearProjectError();
			}
		}
	}
}
